Skip to content

feat: add CreateRelease tool for GitHub releases#1015

Open
zzstoatzz wants to merge 3 commits intogithub:mainfrom
zzstoatzz:feat/add-create-release
Open

feat: add CreateRelease tool for GitHub releases#1015
zzstoatzz wants to merge 3 commits intogithub:mainfrom
zzstoatzz:feat/add-create-release

Conversation

@zzstoatzz
Copy link
Copy Markdown

Summary

This PR adds a new CreateRelease tool to the GitHub MCP server, enabling users to create GitHub releases programmatically through the MCP interface.

Motivation

As discussed in #1012, the GitHub MCP server currently supports reading release information but lacks the ability to create releases. This is a common need for CI/CD workflows and automation tasks. The addition of CreateRelease complements the existing CreateRepository, CreateIssue, and CreatePullRequest tools, providing a more complete set of GitHub operations.

Implementation

The implementation follows the established patterns in the codebase:

  • Uses the same GetClientFn pattern as other tools
  • Follows the parameter handling approach from CreateRepository
  • Implements comprehensive test coverage matching existing test patterns
  • Properly handles both required and optional parameters
  • Returns structured JSON response for successful operations
  • Uses the standard error handling approach with mcp.NewToolResultError

Features

The CreateRelease tool supports:

  • Required parameters: owner, repo, tag_name
  • Optional parameters:
    • target_commitish: Branch or commit SHA for the release
    • name: Release name
    • body: Release description
    • draft: Create as draft release
    • prerelease: Mark as pre-release
    • generate_release_notes: Auto-generate release notes from commits

Testing

Added comprehensive test coverage including:

  • Successful release creation with all parameters
  • Successful release creation with minimal parameters
  • Error handling for API failures (e.g., tag already exists)
  • Table-driven tests following the existing pattern in the codebase

Checklist

Example Usage

{
  "tool": "create_release",
  "parameters": {
    "owner": "octocat",
    "repo": "hello-world",
    "tag_name": "v1.0.0",
    "name": "Version 1.0.0",
    "body": "Initial release",
    "generate_release_notes": true
  }
}

Implements a new CreateRelease tool following the existing pattern used by CreateRepository and other create operations.

Features:
- Creates GitHub releases with tag name, target commitish, and release notes
- Supports draft and prerelease flags
- Supports automatic release notes generation
- Comprehensive test coverage following existing test patterns

Closes github#1012
Copilot AI review requested due to automatic review settings August 30, 2025 15:38
@zzstoatzz zzstoatzz requested a review from a team as a code owner August 30, 2025 15:38

This comment was marked as outdated.

Addresses Copilot review comment - the response body was being closed before attempting to read it in the error case. Now we only close it after reading when needed.
@zzstoatzz zzstoatzz requested a review from Copilot August 30, 2025 17:28

This comment was marked as outdated.

Put single defer statement right after successful API call to ensure body is closed in all paths. Removes duplicate defer statements.
@zzstoatzz zzstoatzz requested a review from Copilot August 30, 2025 17:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a new CreateRelease tool to the GitHub MCP server, enabling programmatic creation of GitHub releases. This complements the existing create tools (repository, issue, pull request) and addresses a gap in the server's GitHub operations support.

Key changes:

  • Added CreateRelease tool with comprehensive parameter support (required: owner, repo, tag_name; optional: target_commitish, name, body, draft, prerelease, generate_release_notes)
  • Implemented proper error handling and response formatting following established patterns
  • Added comprehensive test coverage with table-driven tests for success and error scenarios

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pkg/github/tools.go Registers the new CreateRelease tool in the default toolset
pkg/github/create_release.go Implements the CreateRelease tool with parameter validation and GitHub API integration
pkg/github/create_release_test.go Comprehensive test suite covering success cases and error handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread pkg/github/create_release.go
@zzstoatzz
Copy link
Copy Markdown
Author

this release was created via Claude Code using this MCP as built from this branch

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CreateRelease tool for programmatic release creation

3 participants